% Z = ELEMENTMULT(X,Y) Multiply two Galois Field elements.
%
%   Inputs:
%
%       X,Y     Exponents of the two multiplicands.  The evaluated product
%               is expected to be of the form (a^X)(a^Y)
%
%   Outputs:
%
%       Z       The exponent of the product of X and Y.

function z = elementMult(x,y)
    global m

    % If either multiplicand is zero, return zero
    if isZero(x) || isZero(y)
        z = -1;
        return;
    end

    % Multiplication is modul0o(2^m - 1) addition of the exponents.
    z = mod(x + y,2^m - 1);
end
